﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Water.Architecture2.EntityXML
{
    internal enum RefMode
    {
        InnerJoin,
        LeftJoin,
        RightJoin,
        FullJoin,
        CrossJoin
    }

    internal class RefModeConvert
    {
        internal static RefMode ToRefMode(String refMode)
        {
            RefMode rm;
            switch (refMode.ToLower())
            {
                case "inner join":
                case "innerjoin":
                    rm = RefMode.InnerJoin;
                    break;
                case "left join":
                case "leftjoin":
                    rm = RefMode.LeftJoin;
                    break;
                case "right join":
                case "rightjoin":
                    rm = RefMode.RightJoin;
                    break;
                case "full join":
                case "fulljoin":
                    rm = RefMode.FullJoin;
                    break;
                case "cross join":
                case "crossjoin":
                    rm = RefMode.CrossJoin;
                        break;
                default:
                    rm = RefMode.InnerJoin;
                    break;
            }
            return rm;
        }

        internal static string ToRefModeString(RefMode refMode) 
        {
            string refModeString = string.Empty;
            switch (refMode)
            { 
                case RefMode.InnerJoin:
                    refModeString = "INNER JOIN";
                    break;
                case RefMode.LeftJoin:
                    refModeString = "LEFT JOIN";
                    break;
                case RefMode.RightJoin:
                    refModeString = "RIGHT JOIN";
                    break;
                case RefMode.FullJoin:
                    refModeString = "FULL JOIN";
                    break;
                case RefMode.CrossJoin:
                    refModeString = "CROSS JOIN";
                    break;
                default:
                    refModeString = "INNER JOIN";
                    break;
            }

            return refModeString;
        }
    }
}
